package crazy.memory1;

public class Wolf extends Animal
{
	private String name;
	private double weight;
	
	public Wolf(String name, double weight)
	{
		this.name = name;
		this.weight = weight;
	}
	
	@Override
	public String getDesc()
	{
		return "Wolf[name="+name+", weight="+weight+"]";
	}
	
	public static void main(String[] args)
	{
		System.out.println(new Wolf("huitailang", 32.3));
	}
}

class Animal
{
	private String desc;
	
	public Animal()
	{
		this.desc = getDesc();//此处调用的getDesc()是被子类重写过的。
	}
	
	public String getDesc()
	{
		return "Animal";
	}
	
	public String toString()
	{
		return desc+"........";
		//return getDesc();
	}
}
